<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改商品')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <div class="ibox-content">
        <form class="form-horizontal m" id="form-GoodsInfo-edit" th:object="${goodsInfo}">
            <input name="id" id="id" th:field="*{id}" type="hidden">
            <input name="state" id="state" th:field="*{state}" type="hidden">
            <div class="form-group">
                <label class="col-sm-3 control-label">主标题：</label>
                <div class="col-sm-8">
                    <input name="mianTitle" th:field="*{mianTitle}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">副标题：</label>
                <div class="col-sm-8">
                    <input name="subTitle" th:field="*{subTitle}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">售价：</label>
                <div class="col-sm-8">
                    <input name="price" th:field="*{price}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">起购台数：</label>
                <div class="col-sm-8">
                    <input name="nums" th:field="*{nums}" onkeyup="value=value.replace(/^(0+)|[^\d]+/g,'')" class="form-control" type="number" minlength="1" maxlength="10" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">介绍详情：</label>
                <div class="col-sm-8">
                    <input name="details" th:field="*{details}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">划线价：</label>
                <div class="col-sm-8">
                    <input name="oldPrice" th:field="*{oldPrice}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">成本价格：</label>
                <div class="col-sm-8">
                    <input name="costPrice" th:field="*{costPrice}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">运费：</label>
                <div class="col-sm-8">
                    <input name="freightMoney" th:field="*{freightMoney}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">库存：</label>
                <div class="col-sm-8">
                    <input name="stock" th:field="*{stock}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">虚拟库存：</label>
                <div class="col-sm-8">
                    <input name="fictitiousStock" th:field="*{fictitiousStock}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">库存预警：</label>
                <div class="col-sm-8">
                    <input name="stockEarlyWarning" th:field="*{stockEarlyWarning}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">排序：</label>
                <div class="col-sm-8">
                    <input name="sorts" th:field="*{sorts}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <textarea name="remarks" th:field="*{remarks}" maxlength="300" class="form-control" rows="3"></textarea>
                </div>
            </div>
            <h4 class="form-header h5">图片信息</h4>
            <div class="form-group">
                <label  class="col-sm-3 control-label">首页图:</label>
                <br/>
                <div class="col-sm-8">
                    <div class="fileinput fileinput-new" data-provides="fileinput">
                        <div class="fileinput-preview thumbnail" data-trigger="fileinput" style="width: 200px; height: 150px;"></div>
                        <div>
                            <span class="btn btn-white btn-file"><span class="fileinput-new">选择图片</span><span class="fileinput-exists">更改</span><input id="home" name="home" type="file"></span>
                            <a href="#" class="btn btn-white fileinput-exists" data-dismiss="fileinput">清除</a>
                        </div>
                    </div>
                </div>
            </div>
            <button style="margin-left: 30px;"  type="button" class="btn btn-default" onclick="insert()">新增详情图</button>
            <div class="form-group">
                <label  class="col-sm-3 control-label">详情图:</label>
                <br/>
                <div class="col-sm-8" id="parent" style="vertical-align:top">
                    <div class="fileinput fileinput-new" data-provides="fileinput">
                        <div class="fileinput-preview thumbnail" data-trigger="fileinput" style="width: 200px; height: 150px;"></div>
                        <div>
                            <span class="btn btn-white btn-file"><span class="fileinput-new">选择图片</span><span class="fileinput-exists">更改</span><input id="dImg" name="dImg" type="file"></span>
                            <a href="#" class="btn btn-white fileinput-exists" data-dismiss="fileinput">清除</a><br><br>
                        </div>
                    </div>
                </div>
            </div>
            <button style="margin-left: 30px;"  type="button" class="btn btn-default" onclick="lbInsert()">新增轮播图</button>
            <div class="form-group">
                <label  class="col-sm-3 control-label">轮播图:</label>
                <br/>
                <div class="col-sm-8" id="lb" style="vertical-align:top">
                    <div class="fileinput fileinput-new" data-provides="fileinput">
                        <div class="fileinput-preview thumbnail" data-trigger="fileinput" style="width: 200px; height: 150px;"></div>
                        <div>
                            <span class="btn btn-white btn-file"><span class="fileinput-new">选择图片</span><span class="fileinput-exists">更改</span><input id="lbImg" name="lbImg" type="file"></span>
                            <a href="#" class="btn btn-white fileinput-exists" data-dismiss="fileinput">清除</a><br><br>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "GoodsInfo/GoodsInfo";
        function submitHandler() {
            if ($("#state").val() == '1'){
                $.modal.alertWarning("请先下架商品");
                return;
            }
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-GoodsInfo-edit').serialize());
            }
        }



    </script>
</body>
</html>